home *** CD-ROM | disk | FTP | other *** search
/ Fritz: All Fritz / All Fritz.zip / All Fritz / FILES / PROGASIC / COMMENTS.LZH / PRINTDOC.BAS < prev    next >
BASIC Source File  |  1991-04-16  |  4KB  |  84 lines

  1. ' ┌┬──────────────────────────────────────────────────────────────────────┬┐
  2. ' ││ Name     : PRINTDOC                                                  ││
  3. ' ││ Type     : Utility                                                   ││
  4. ' ││ Module   : PRINTDOC.BAS                                              ││
  5. ' ││ Language : MicroSoft QuickBASIC Version 4.5                          ││
  6. ' ││ Source   : LAMCO Software                                            ││
  7. ' └┴──────────────────────────────────────────────────────────────────────┴┘
  8. ' ┌┬──────────────────────────── DESCRIPTION ─────────────────────────────┬┐
  9. ' ││ This simple program will print the file COMMENTS.DOC in 12 cpi       ││
  10. ' ││ pitch with a left margin of 1 1/2 inch.                              ││
  11. ' └┴──────────────────────────────────────────────────────────────────────┴┘
  12. ' ┌┬──────────────────────────── REQUIREMENTS ────────────────────────────┬┐
  13. ' ││ (none)                                                               ││
  14. ' └┴──────────────────────────────────────────────────────────────────────┴┘
  15. ' ┌┬───────────────────────────── .MAK FILE ──────────────────────────────┬┐
  16. ' ││ (not required)                                                       ││
  17. ' └┴──────────────────────────────────────────────────────────────────────┴┘
  18. ' ┌┬────────────────────── COMMAND LINE PARAMETERS ───────────────────────┬┐
  19. ' ││ (none)                                                               ││
  20. ' └┴──────────────────────────────────────────────────────────────────────┴┘
  21. ' ┌┬───────────────────────────── VARIABLES ──────────────────────────────┬┐
  22. ' ││ IsFileThere#    Flag telling if the file is in the current directory ││
  23. ' ││ LineRead$       A line read from the file                            ││
  24. ' └┴──────────────────────────────────────────────────────────────────────┴┘
  25.  
  26. ' Clear the screen
  27.   CLS
  28.  
  29. ' Verify that COMMENTS.DOC is in the current directory
  30.   OPEN "comments.doc" FOR RANDOM AS #1
  31.   IsFileThere# = LOF(1)
  32.   CLOSE #1
  33.  
  34. ' If the file is not there, display the proper message and exit
  35.   IF IsFileThere# = 0 THEN
  36.     KILL "comments.doc"                 ' Erase the 0 byte file
  37.     LOCATE 4, 10
  38.     PRINT "The file COMMENTS.DOC must be in the current directory."
  39.     LOCATE 6, 10
  40.     PRINT "Please copy the file and load this program again."
  41.     LOCATE 8, 10
  42.     SYSTEM
  43.   END IF
  44.  
  45. ' Ask user to turn the printer on and align the paper
  46.   LOCATE 4, 10
  47.   PRINT "Please turn printer on and align top of page."
  48.   LOCATE 7, 10
  49.   PRINT "Press any key when ready ..."
  50.   BEEP
  51.   DO: LOOP UNTIL INKEY$ <> ""              ' Wait for a key to be pressed
  52.  
  53.   WIDTH "LPT1:", 255                       ' Set printer width to 255
  54.   LPRINT CHR$(27) + "!" + CHR$(1)          ' Set printer pitch to 12 cpi
  55.   LPRINT CHR$(27) + "m" + CHR$(3)          ' Set printer to graphic mode
  56.  
  57.   OPEN "comments.doc" FOR INPUT AS #1      ' Open the file for reading
  58.  
  59.   LINE INPUT #1, LineRead$                 ' Read first two lines to
  60.   LINE INPUT #1, LineRead$                 ' compensate for the two linefeeds
  61.                                            ' we got when setting the printer
  62.  
  63.   DO UNTIL EOF(1)                          ' Read the whole file
  64.     LINE INPUT #1, LineRead$               ' Read one line
  65.     LPRINT STRING$(13, 32); LineRead$      ' Add the left margin and print it
  66.   LOOP
  67.   CLOSE #1                                 ' Close the file
  68.  
  69. ' Tell the user the printing is completed and exit
  70.   LOCATE 12, 10
  71.   PRINT "Printing of the COMMENTS' user's manual completed."
  72.   PRINT
  73.   PRINT
  74.  
  75. ' Reset the printer to the default settings
  76.   WIDTH "LPT1:", 80                        ' Set printer width to 80
  77.   LPRINT CHR$(27) + "!" + CHR$(0)          ' Set printer pitch to 10 cpi
  78.   LPRINT CHR$(27) + "m" + CHR$(0)          ' Set printer to text mode
  79.  
  80.   SYSTEM                                   ' Exit the program
  81.  
  82.   END                                      ' End of the module level
  83.  
  84.